package mybatis.test;

import mybatis.MyBatisUtils;
import mybatis.mapper.StudentMapper;
import mybatis.pojo.Student;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class addStudents {
    public static void main(String[] args) {
        Student student1 = new Student("zs", 18);
        Student student2 = new Student("ls", 19);
        Student student3 = new Student("ww",21);
        List<Student> students = List.of(student1, student2, student3);
        SqlSession sqlSession = MyBatisUtils.getSession();
        StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);
        studentMapper.addStudents(students);
        sqlSession.commit();
        sqlSession.close();
    }
}
